﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Data.SqlClient;
using System.Configuration;
using ComercioBase.classes;

namespace ComercioBase.DAO
{
    public class FornecedorDAO
    {


        public static void addFornecedor(Fornecedor fornecedor)
        {
            SqlConnection Cx = new SqlConnection(ConfigurationManager.ConnectionStrings["StringConexaoLocal"].ConnectionString);
            SqlCommand Cm = new SqlCommand("INSERT INTO fornecedores (nome, email, telefone) VALUES ( @nome, @email, @telefone)", Cx);
            Cm.Parameters.AddWithValue("@nome", fornecedor.Nome).DbType = System.Data.DbType.String;
            Cm.Parameters.AddWithValue("@email", fornecedor.Email).DbType = System.Data.DbType.String;
            Cm.Parameters.AddWithValue("@telefone", fornecedor.Telefone).DbType = System.Data.DbType.String;
            Cx.Open();
            Cm.ExecuteNonQuery();
            Cx.Close();

        }


    }
}